import React, { Component } from 'react'
import store from "./store"
 class App extends Component {
  render() {
    console.log(store.getState());
    let action={
      type:"ADD",
      payload:{
        step:1
      }
    }
    let unsubscribe= store.subscribe(function(res){
      console.log("发生变化",res);
    })
    unsubscribe()
    store.dispatch(action)
    console.log(store.getState());
    return (
      <div>
        <button onClick={this.props.sub}>-</button>
        {this.props.num}
        <button onClick={this.props.add}>+</button>
      </div>
    )
  }
}

export default App